<style>
    .c_box{
        margin:10px;
        cursor: pointer;
    }
    .cur{
        color:red;
    }
    .optiontext{
        padding-top: 5px;
        text-align: left; vertical-align: middle;
    }
</style>
<div class="panel panel-default panel-intro">
    <div class="panel-body">
        <div id="" class="tab-content">
            <div class="tab-pane fade active in" id="one">
                <div class="widget-body no-padding">
                    <div class="bootstrap-table">
                        <div class="fixed-table-toolbar">
                            <form action="" method="post" id="js_sub">
                                    <div style="margin-bottom: 10px;">
                                        <span  class="c_box" onclick="sub1(0,0)">全部</span>
                                        <span  class="c_box" onclick="sub1(1,1)">跟团游</span>
                                        <span  class="c_box" onclick="sub1(1,2)">包团游</span>
                                        <span  class="c_box" onclick="sub1(1,4)">自由行</span>
                                        <input type="hidden" name="type"  id="js_box"/>
                                        <input type="hidden" name="svalue"  id="js_boxvalue"/>
                                    </div>
                                    <div style="margin-bottom: 10px;">
                                        ID <input  type="text" name="id" value="{notempty name='$search.id'}{$search.id}{/notempty}" style="width:120px;"/>
                                        产品编号 <input type="text" name="p_no" value="{notempty name='$search.p_no'}{$search.p_no}{/notempty}" style="width:120px;"/>
                                        天数 <input type="text" name="p_day" value="{notempty name='$search.p_day'}{$search.p_day}{/notempty}" style="width:120px;"/>
                                        名称 <input type="text" name="p_name" value="{notempty name='$search.p_name'}{$search.p_name}{/notempty}" style="width:120px;"/>
                                        状态 <select name="status" style="height:24px">
                                        <option value="100" >请选择</option>
                                        {volist name="status1" id="vo" key="k"}
                                        <option value="{$k-1}"
                                                {if condition="$search.status eq ($k-1)"}selected="selected" { /if } >{$vo}</option>
                                        {/volist}
                                    </select>
                                        <input type="submit" value="搜索" style="    border: 0;
                                        background-color: #18bc9c;
                                        width: 80px;
                                        height: 26px;
                                        position: relative;
                                        top: -2px;
                                        color: #fff;
                                        border-radius: 10px;"/>
                                    </div>
                                </form>
                                    <div id="toolbar" class="toolbar" style="position: relative; margin-bottom: 10px;">
                                        <a href="/admin/product/product_add" class="btn btn-success btn-add " title="添加"><i class="fa fa-plus"></i> 添加产品</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <!-- <form name="form1" method="get" action="/admin/product/product_oldinput">
                                            输入旧网站产品id <input type="text" name="p_id"/><input type="submit" value="一键导入"/>
                                        </form> -->
                                    </div>
                                </div>
                                <table  class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
                                    <thead>
                                    <tr>
                                        <th style="text-align: center; vertical-align: middle;" data-field="id" height="45">
                                            <div class="th-inner ">ID</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;" data-field="pno">
                                            <div class="th-inner ">产品编号</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width:200px;" data-field="p_name">
                                            <div class="th-inner ">名称</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;" data-field="type">
                                            <div class="th-inner ">产品类型</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;" data-field="linkto">
                                            <div class="th-inner ">天数</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;" data-field="linkto">
                                            <div class="th-inner ">最低价</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle" data-field="linkto">
                                            <div class="th-inner ">折扣</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle" data-field="linkto">
                                            <div class="th-inner ">产品状态</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; vertical-align: middle;width: 20%;" data-field="operate">
                                            <div class="th-inner ">操作</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody data-listidx="0">
                                    {volist name="list" id="vo"}
                                    <tr data-index="0">
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo.id}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo.p_no}
                                        </td>
                                        <td style="vertical-align: middle;width:400px;white-space: normal;">
                                            <a target="_blank"  href="/index/show/detail?id={$vo.id}"> {$vo.p_name}</a>
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            <?php echo getstr("product-p_type",$vo['p_type']);?>
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo['p_day']}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {exratecur}{/exratecur}
                                            {exratesum}$vo['lowprice']{/exratesum}
                                            {exratecurtxt}{/exratecurtxt}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            {$vo['discount']}
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; cursor: pointer "><!--fa fa-toggle-on fa-rotate-180 text-gray fa-2x-->
                                            <?php echo getstr("product-status",$vo['status']);?>
                                            <br/>
                                            <i class="fa fa-toggle-on text-success fa-2x" status="{$vo.status}" product_id="{$vo.id}" onclick="product_status(this);"></i>
                                        </td>
                                        <td style="text-align: center; vertical-align: middle; ">
                                            <div class="optiontext">
                                            <a href="/admin/product/product_edit?id={$vo.id}" class="btn btn-success btn-edit" title="修改"> 修改</a>
                                            <a href="/admin/product/index_mark?id={$vo.id}&type=0" class="btn btn-success btn-add" title="标签"> 标签{if condition="$vo.mark_count gt 0"}({$vo.mark_count}){/if}</a>
                                                <a href="/admin/product/product_package?pid={$vo.id}&fid=0" class="btn btn-success btn-add" title="产品套餐"> 产品套餐</a>
                                           <!--
                                            <a href="/admin/product/product_line?id={$vo.id}" class="btn btn-success btn-add" title="修改线路"> 修改线路</a>
                                           -->
                                                </div>
                                            <div class="optiontext">
                                            <a href="/admin/product/group_package?pid={$vo['id']}&p_type={$vo['p_type']}" class="btn btn-success btn-add" title="产品团期"> 团期</a>
                                            <!--
                                            <a href="/admin/product/group_bt?id={$vo['id']}" class="btn btn-success btn-add" title="包团游"><i class="fa fa-plus"></i> 包团游</a>
                                            -->
                                            <a href="/admin/product/product_chargeable?pid={$vo['id']}&fid=0" class="btn btn-success btn-add" title="自费项目"> 自费项目{if condition="$vo.self_pay_count gt 0"}({$vo.self_pay_count}){/if}
                                            </a>
                                                </div>
                                            <div class="optiontext">
                                            <a href="/admin/product/route_package?pid={$vo['id']}" class="btn btn-success btn-add" title="产品行程">行程</a>
                                            <a href="/admin/product/info_index?p_id={$vo['id']}" class="btn btn-success btn-add" title="产品信息维护">产品信息维护</a>
                                            <a href="/admin/product/index_img?id={$vo.id}" class="btn btn-success btn-add" title="产品图片"> 产品图片</a>
                                            <!--
                                            <a href="/admin/product/link_copy?p_id={$vo['id']}" class="btn btn-success btn-add" title="复制线路"><i class="fa fa-plus"></i>复制线路</a>
                                            <a href="/admin/product/del?id={$vo.id}" onclick="return confirm('确定要删除该节点以及其下子节点吗');"  class="btn btn-success btn-add btn-disabled" title="删除"><i class="fa fa-trash"></i> 删除</a>
                                            -->
                                                </div>
                                            <div class="optiontext">
                                                <?php if ($_SESSION['think']['admin']['id']==7){?>
                                                <a href="javascript:;" onclick="product_del('{$vo.id}');"  class="btn btn-success btn-add btn-disabled" title="删除">删除</a>
                                            <?php } ?>
                                                <a href="/admin/product/index_linkp?pid={$vo.id}"  class="btn btn-success btn-add btn-disabled" title="关联推荐产品">关联推荐产品{if condition="$vo.adsense_count gt 0"}({$vo.adsense_count}){/if}</a>
                                                <a href="/admin/product/reviews?id={$vo['id']}"  class="btn btn-success btn-add btn-disabled" title="产品点评">产品点评{if condition="$vo.evaluation_count gt 0"}({$vo.evaluation_count}){/if}</a>
                                            </div>
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                        <div>{$page}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<script>
    function product_status(obj){
        var status=$(obj).attr("status");
        var product_id=$(obj).attr("product_id");
        $.ajax({
            type:'post',
            dataType:'json',
            url:"/admin/product/product_status",
            data:{"id":product_id,"status":status},
            success:function(data){
                if(data.status==1){
                    alert(data.message);
                    location.reload();
                }else{
                    alert(data.message);
                }
            }
        })
    }
    function product_del(id){
        $.ajax({
            type:'post',
            dataType:'json',
            url:"/admin/product/product_del",
            data:{"id":id},
            success:function(data){
                if(data.status==1){
                    alert(data.message);
                    location.reload();
                }else{
                    alert(data.message);
                }
            }
        })
    }
    function sub1(stype,svalue){
        $("#js_box").val(stype);
        $("#js_boxvalue").val(svalue);
$("#js_sub").submit();
    }
</script>
